using System.Windows.Forms;
using FireStarterModeller.BO;
using FireStarterModeller.UI;
using FireStarterModeller.UI.ViewEditor;
using Habanero.Base;
using Habanero.BO;
using Habanero.Faces.Base;
using Habanero.Faces.Win;
using NUnit.Framework;
using Rhino.Mocks;

namespace FireStarterModeller.Test.UI
{
    [TestFixture]
    public class TestDMClassEditorControl
    {
        [TestFixtureSetUp]
        public void SetupFixture()
        {
            UITestUtils.SetupFixture();
        }


        [SetUp]
        public virtual void SetupTest()
        {
            UITestUtils.SetupTest();
        }

        private static IControlFactory CreateControlFactory()
        {
            return new ControlFactoryWin();
        }

        [Test]
        public void Test_Construct()
        {
            //---------------Set up test pack-------------------
            IControlFactory controlFactory = CreateControlFactory();
            //---------------Assert Precondition----------------
            Assert.IsNotNull(controlFactory);
            //---------------Execute Test ----------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(controlFactory);
            //---------------Test Result -----------------------
            Assert.AreSame(controlFactory, dmClassEditorControl.ControlFactory);
            Assert.IsNotNull(dmClassEditorControl.DetailPanelInfo);
            Assert.IsNotNull(dmClassEditorControl.SuperClassControl);
        }

        [Test]
        public void Test_Layout()
        {
            //---------------Set up test pack-------------------
            IControlFactory controlFactory = CreateControlFactory();
            //---------------Assert Precondition----------------
            Assert.IsNotNull(controlFactory);
            //---------------Execute Test ----------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(controlFactory);
            //---------------Test Result -----------------------
            Assert.AreEqual(1, dmClassEditorControl.Controls.Count);
            Control classPanel = dmClassEditorControl.Controls[0];
            Assert.IsInstanceOf(typeof(IPanel), classPanel);
            Assert.AreEqual(2, classPanel.Controls.Count);

            Control classDetailGroupBox = classPanel.Controls[0];
            Assert.IsInstanceOf(typeof(IGroupBox), classDetailGroupBox);
            Control classDetailsPanel = classDetailGroupBox.Controls[0];
            Assert.IsInstanceOf(typeof(IPanel), classDetailsPanel);
            Assert.AreSame(dmClassEditorControl.DetailPanelInfo.Panel, classDetailsPanel);

            Control superClassGroupBox = classPanel.Controls[1];
            Assert.IsInstanceOf(typeof(IGroupBox), superClassGroupBox);
            Control superClassControl = superClassGroupBox.Controls[0];
            Assert.IsInstanceOf(typeof(SuperClassControl), superClassControl);
            Assert.AreSame(dmClassEditorControl.SuperClassControl, superClassControl);

//            Control buttonsPanel = dmClassEditorControl.Controls[1];
//            Assert.IsInstanceOf(typeof(IButtonGroupControl), buttonsPanel);
//            Assert.AreEqual(2, buttonsPanel.Controls.Count);
//            Assert.IsFalse(dmClassEditorControl.CreateUIDefButton.Enabled);
        }

        [Test]
        public void Test_DetailPanelLayout()
        {
            //---------------Execute Test ----------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            //---------------Test Result -----------------------
            IPanelInfo panelInfo = dmClassEditorControl.DetailPanelInfo;
            Assert.IsNotNull(panelInfo);
            PanelInfo.FieldInfoCollection mappers = panelInfo.FieldInfos;
            Assert.IsNotNull(mappers);
            Assert.AreEqual(7, mappers.Count);
            Assert.IsInstanceOf(typeof (ITextBox), mappers["ClassNameBO"].ControlMapper.Control);
            Assert.IsInstanceOf(typeof(ITextBox), mappers["MappedTableName"].ControlMapper.Control);
            Assert.IsInstanceOf(typeof (ITextBox), mappers["DisplayName"].ControlMapper.Control);
        }

        [Test]
        public void Test_AssemblyCombo_ShouldBeDisabled()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            //---------------Test Result -----------------------
            PanelInfo.FieldInfo assemblyFieldInfo = dmClassEditorControl.DetailPanelInfo.FieldInfos["Assembly"];
            Assert.IsNotNull(assemblyFieldInfo);
            Assert.IsFalse(assemblyFieldInfo.InputControl.Enabled);
        }

        [Test]
        public void Test_BusinessObject_WhenSet_ThenAssemblyControlMapper_ShouldHaveCorrectBusinessObjectCollection()
        {
            //---------------Set up test pack-------------------
            DMClass dmClass = TestUtilsShared.CreateUnsavedValidDMClass();
            DMSolution solution = (DMSolution) dmClass.Solution;
            DMAssembly assembly = solution.CreateAssembly(TestUtilsShared.GetRandomString());
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            //---------------Assert Precondition----------------
            Assert.AreEqual(2, solution.Assemblies.Count);
            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = dmClass;
            //---------------Test Result -----------------------
            IPanelInfo panelInfo = dmClassEditorControl.DetailPanelInfo;
            RelationshipComboBoxMapper controlMapper =
                (RelationshipComboBoxMapper) panelInfo.FieldInfos["Assembly"].ControlMapper;
            IBusinessObjectCollection businessObjectCollection = controlMapper.BusinessObjectCollection;
            Assert.IsNotNull(businessObjectCollection);
            Assert.AreEqual(2, businessObjectCollection.Count);
            IComboBoxObjectCollection comboItems = controlMapper.Control.Items;
            Assert.IsTrue(comboItems.Contains(dmClass.Assembly), "Should contiain the default assembly");
            Assert.IsTrue(comboItems.Contains(assembly), "Should contiain the alternate assembly");
            Assert.AreEqual(2, comboItems.Count, "Should not have a blank item");
//            Assert.IsTrue(dmClassEditorControl.CreateUIDefButton.Enabled);
        }

        [Test]
        public void Test_ReSetBusinessObject_ShouldHaveNewBO()
        {
            //---------------Set up test pack-------------------

            DMClass dmClass = TestUtilsShared.CreateUnsavedValidDMClass();
            DMSolution solution = (DMSolution) dmClass.Solution;
            DMAssembly assembly = solution.CreateAssembly(TestUtilsShared.GetRandomString());
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            dmClassEditorControl.BusinessObject = dmClass;
            DMClass newDMClass = assembly.Classes.CreateBusinessObject();
            //---------------Assert Precondition----------------
            Assert.AreSame(dmClass, dmClassEditorControl.BusinessObject);
            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = newDMClass;

            //---------------Test Result -----------------------
            Assert.AreSame(newDMClass, dmClassEditorControl.BusinessObject);
        }

        [Test]
        public void Test_BusinessObject_WhenSetToNull_ThenAssemblyControlMapper_ShouldHaveCorrectBusinessObjectCollection()
        {
            //---------------Set up test pack-------------------

            DMClass dmClass = TestUtilsShared.CreateUnsavedValidDMClass();
            DMSolution solution = (DMSolution) dmClass.Solution;
            DMAssembly assembly = solution.CreateAssembly(TestUtilsShared.GetRandomString());
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            dmClassEditorControl.BusinessObject = dmClass;
            //---------------Assert Precondition----------------
            Assert.AreEqual(2, solution.Assemblies.Count);
            IPanelInfo panelInfo = dmClassEditorControl.DetailPanelInfo;
            RelationshipComboBoxMapper controlMapper =
                (RelationshipComboBoxMapper) panelInfo.FieldInfos["Assembly"].ControlMapper;
            IBusinessObjectCollection businessObjectCollection = controlMapper.BusinessObjectCollection;
            Assert.IsNotNull(businessObjectCollection);
            Assert.AreEqual(2, businessObjectCollection.Count);
            Assert.AreEqual(2, controlMapper.Control.Items.Count);
            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = null;

            //---------------Test Result -----------------------
            businessObjectCollection = controlMapper.BusinessObjectCollection;
            Assert.IsNotNull(businessObjectCollection);
            Assert.AreEqual(2, businessObjectCollection.Count);
            Assert.AreEqual(2, controlMapper.Control.Items.Count, "Should not have a blank item");
        }

        [Test]
        public void Test_BusinessObject_WhenSet_ShouldBeSetOnDetailPanelInfo()
        {
            //---------------Set up test pack-------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            DMClass newBO = new DMClass();
            //---------------Assert Precondition----------------
            Assert.AreEqual(dmClassEditorControl.BusinessObject, dmClassEditorControl.DetailPanelInfo.BusinessObject);
            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = newBO;
            //---------------Test Result -----------------------
            Assert.AreSame(newBO, dmClassEditorControl.BusinessObject);
            Assert.AreSame(newBO, dmClassEditorControl.DetailPanelInfo.BusinessObject);
        }

        [Test]
        public void Test_BusinessObject_WhenSetToNull_ShouldBeSetOnDetailPanelInfo()
        {
            //---------------Set up test pack-------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            DMClass newBO = new DMClass();
            dmClassEditorControl.BusinessObject = newBO;
            //---------------Assert Precondition----------------
            Assert.AreSame(newBO, dmClassEditorControl.BusinessObject);
            Assert.AreSame(newBO, dmClassEditorControl.DetailPanelInfo.BusinessObject);
            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = null;
            //---------------Test Result -----------------------
            Assert.IsNull(dmClassEditorControl.BusinessObject);
            Assert.IsNull(dmClassEditorControl.DetailPanelInfo.BusinessObject);
        }

        [Test]
        public void Test_BusinessObject_WhenSet_ShouldSetOnSuperClassControl()
        {
            //---------------Set up test pack-------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            DMClass newBO = new DMClass();
            //---------------Assert Precondition----------------
            Assert.AreEqual(dmClassEditorControl.BusinessObject, dmClassEditorControl.DetailPanelInfo.BusinessObject);
            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = newBO;
            //---------------Test Result -----------------------
            Assert.AreSame(newBO, dmClassEditorControl.BusinessObject);
            Assert.AreSame(newBO, dmClassEditorControl.SuperClassControl.SubClass);
        }

        [Test]
        public void Test_BusinessObject_WhenSetToNull_ShouldSetNullOnSuperClassControl()
        {
            //---------------Set up test pack-------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            DMClass newBO = new DMClass();
            dmClassEditorControl.BusinessObject = newBO;
            //---------------Assert Precondition----------------
            Assert.AreSame(newBO, dmClassEditorControl.BusinessObject);
            Assert.AreSame(newBO, dmClassEditorControl.SuperClassControl.SubClass);
            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = null;
            //---------------Test Result -----------------------
            Assert.IsNull(dmClassEditorControl.BusinessObject);
            Assert.IsNull(dmClassEditorControl.SuperClassControl.SubClass);
        }

        [Ignore("Changing how this works")]
        [Test]
        public void Test_DisplayErrors()
        {
            //---------------Set up test pack-------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            DMClass newBO = new DMClass();
            dmClassEditorControl.BusinessObject = newBO;
            PanelInfo.FieldInfo fieldInfo = dmClassEditorControl.DetailPanelInfo.FieldInfos["ClassNameBO"];
            //---------------Assert Precondition----------------
            Assert.IsFalse(fieldInfo.ControlMapper.ErrorProvider.GetError(fieldInfo.InputControl).Length > 0);
            //---------------Execute Test ----------------------
            dmClassEditorControl.DisplayErrors();
            //---------------Test Result -----------------------
            Assert.IsTrue(fieldInfo.ControlMapper.ErrorProvider.GetError(fieldInfo.InputControl).Length > 0);
        }

        [Ignore("Changing how this works")]
        [Test]
        public void Test_ClearErrors()
        {
            //---------------Set up test pack-------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            DMClass newBO = new DMClass();
            dmClassEditorControl.BusinessObject = newBO;
            PanelInfo.FieldInfo fieldInfo = dmClassEditorControl.DetailPanelInfo.FieldInfos["ClassNameBO"];
            dmClassEditorControl.DisplayErrors();
            //---------------Assert Precondition----------------
            Assert.IsTrue(fieldInfo.ControlMapper.ErrorProvider.GetError(fieldInfo.InputControl).Length > 0);
            //---------------Execute Test ----------------------
            dmClassEditorControl.ClearErrors();
            //---------------Test Result -----------------------
            Assert.IsFalse(fieldInfo.ControlMapper.ErrorProvider.GetError(fieldInfo.InputControl).Length > 0);
        }

        [Test]
        public void Test_BusinessObject_WhenSet_ShouldSetAssembliesComboSelectedItem()
        {
            //---------------Set up test pack-------------------
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            IComboBox comboBox = (IComboBox) dmClassEditorControl.DetailPanelInfo.FieldInfos["Assembly"].InputControl;
            DMClass newBO = TestUtilsDMClass.CreateUnsavedValidDMClass();
            DMAssembly dmAssembly = newBO.Assembly;
            //---------------Assert Precondition----------------
            Assert.IsNotNull(dmAssembly);
            Assert.AreNotSame(dmAssembly, comboBox.SelectedItem);
            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = newBO;
            //---------------Test Result -----------------------
            Assert.GreaterOrEqual(comboBox.Items.Count, 2);
            Assert.IsNotNull( comboBox.SelectedItem);
            Assert.AreSame(dmAssembly, comboBox.SelectedItem);
        }

/*        [Test]
        public void Test_CreateUIDefinition_ShouldFirstSaveClass_BeforeOpeningWizard()
        {
            //---------------Set up test pack-------------------
            DMSolution dmSolution = TestUtilsShared.CreateSavedDMSolution();
            DMClass dmClass = dmSolution.DefaultAssembly.CreateClass(TestUtilsShared.GetRandomString());
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            dmClass.ClassNameBO = null;
            dmClassEditorControl.BusinessObject = dmClass;
            //---------------Assert Precondition----------------
            Assert.IsFalse(dmClass.Status.IsValid());
            Assert.AreSame(dmClass, dmClassEditorControl.BusinessObject);
            //---------------Execute Test ----------------------
            try
            {
                dmClassEditorControl.CreateUIDefButton.PerformClick();

                Assert.Fail("Expected to throw an Exception");
            }
            //---------------Test Result -----------------------
            catch (BusObjectInAnInvalidStateException ex)
            {
                StringAssert.Contains("Entity Name' is a compulsory field and has no value", ex.Message);
            }
          
        }*/

        private class ControlFactoryStub : ControlFactoryWin
        {
            public override IWizardForm CreateWizardForm(IWizardController wizardController)
            {
                return MockRepository.GenerateStub<IWizardForm>();
            }
        }

        /*[Test]
        public void Test_CreateUIDefinition_ShouldFirstSaveClass_BeforeOpeningWizard1()
        {
            //---------------Set up test pack-------------------
            DMSolution dmSolution = TestUtilsShared.CreateSavedDMSolution();

            //IWizardForm wizardFormStub = MockRepository.GenerateStub<IWizardForm>();
            //ControlFactoryWin controlFactoryStub = MockRepository.GenerateStub<ControlFactoryWin>();
            //controlFactoryStub.Stub(win => win.CreatePanel()).Return(new PanelWin());
            //controlFactoryStub.Stub(win => win.CreateTextBox()).Return(new PanelWin());
            //controlFactoryStub.Stub(cf => cf.CreateWizardForm(null)).IgnoreArguments().Return(wizardFormStub);

            //DMClass dmClass = MockRepository.GenerateMock<DMClass>(ClassDef.Get<DMClass>());
            DMClass dmClass = dmSolution.DefaultAssembly.CreateClass(TestUtilsShared.GetRandomString());

            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(new ControlFactoryStub());
            //dmClass.ClassNameBO = null;
            dmClassEditorControl.BusinessObject = dmClass;
            //---------------Assert Precondition----------------
            //Assert.IsFalse(dmClass.Status.IsValid());
            Assert.IsTrue(dmClass.Status.IsNew);
            Assert.AreSame(dmClass, dmClassEditorControl.BusinessObject);
            //---------------Execute Test ----------------------
            //try
            //{
                dmClassEditorControl.CreateUIDefButton.PerformClick();

            //    Assert.Fail("Expected to throw an Exception");
            //}
            //---------------Test Result -----------------------
            //catch (BusObjectInAnInvalidStateException ex)
            //{
            //    StringAssert.Contains("Entity Name' is a compulsory field and has no value", ex.Message);
            //}     
            Assert.IsFalse(dmClass.Status.IsNew);
            //controlFactoryStub.AssertWasCalled(win => win.CreatePanel());
            //controlFactoryStub.AssertWasCalled(win => win.CreateTreeNode(null));
        }*/

       /* [Test]
        public void Test_EditUIDefinitionButton_DisabledByDefault()
        {
            //---------------Set up test pack-------------------
            //ControlFactoryWin controlFactoryStub = MockRepository.GenerateStub<ControlFactoryWin>();

            //---------------Execute Test ----------------------
            //DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(controlFactoryStub);
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());

            //---------------Test Result -----------------------
            Assert.IsFalse(dmClassEditorControl.EditUIDefinitionButton.Enabled);
            //---------------Tear Down -------------------------          
        }

        [Test]
        public void Test_EditUIDefinitionButton_DisabledWhenBOHasNoUIView()
        {
            //---------------Set up test pack-------------------
            DMSolution dmSolution = TestUtilsShared.CreateSavedDMSolution();
            DMClass dmClass = dmSolution.DefaultAssembly.CreateClass(TestUtilsShared.GetRandomString());
            //ControlFactoryWin controlFactoryStub = MockRepository.GenerateStub<ControlFactoryWin>();
            //DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(controlFactoryStub);
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());

            //---------------Assert Precondition----------------
            Assert.AreEqual(0, dmClass.UIViews.Count);

            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = dmClass;
            
            //---------------Test Result -----------------------
            Assert.IsFalse(dmClassEditorControl.EditUIDefinitionButton.Enabled);
            
            //---------------Tear Down -------------------------          
        }*/

       /* [Test]
        public void Test_EditUIDefinitionButton_EnabledWhenBOHasUIView()
        {
            //---------------Set up test pack-------------------
            DMSolution dmSolution = TestUtilsShared.CreateSavedDMSolution();
            DMClass dmClass = dmSolution.DefaultAssembly.CreateClass(TestUtilsShared.GetRandomString());
            dmClass.UIViews.CreateBusinessObject();
            //ControlFactoryWin controlFactoryStub = MockRepository.GenerateStub<ControlFactoryWin>();
            //DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(controlFactoryStub);
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());

            //---------------Assert Precondition----------------
            Assert.AreEqual(1, dmClass.UIViews.Count);

            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = dmClass;

            //---------------Test Result -----------------------
            Assert.IsTrue(dmClassEditorControl.EditUIDefinitionButton.Enabled);

            //---------------Tear Down -------------------------                 
        }

        [Test]
        public void Test_EditUIDefinitionButton_DisabledWhenBOIsNull()
        {
            //---------------Set up test pack-------------------
            DMSolution dmSolution = TestUtilsShared.CreateSavedDMSolution();
            DMClass dmClass = dmSolution.DefaultAssembly.CreateClass(TestUtilsShared.GetRandomString());
            dmClass.UIViews.CreateBusinessObject();
            //ControlFactoryWin controlFactoryStub = MockRepository.GenerateStub<ControlFactoryWin>();
            //DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(controlFactoryStub);
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            dmClassEditorControl.BusinessObject = dmClass;

            //---------------Assert Precondition----------------
            Assert.IsTrue(dmClassEditorControl.EditUIDefinitionButton.Enabled);

            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = null;

            //---------------Test Result -----------------------
            Assert.IsFalse(dmClassEditorControl.EditUIDefinitionButton.Enabled);

            //---------------Tear Down -------------------------                 
        }


        [Test]
        public void Test_EditUIDefinitionButton_DisabledWhenBOIsResetToOneWithNoUIViews()
        {
            //---------------Set up test pack-------------------
            DMSolution dmSolution = TestUtilsShared.CreateSavedDMSolution();
            DMClass dmClass1 = dmSolution.DefaultAssembly.CreateClass(TestUtilsShared.GetRandomString());
            dmClass1.UIViews.CreateBusinessObject();
            DMClass dmClass2 = dmSolution.DefaultAssembly.CreateClass(TestUtilsShared.GetRandomString());

            //ControlFactoryWin controlFactoryStub = MockRepository.GenerateStub<ControlFactoryWin>();
            //DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(controlFactoryStub);
            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(CreateControlFactory());
            dmClassEditorControl.BusinessObject = dmClass1;
            
            //---------------Assert Precondition----------------
            Assert.IsTrue(dmClassEditorControl.EditUIDefinitionButton.Enabled);

            //---------------Execute Test ----------------------
            dmClassEditorControl.BusinessObject = dmClass2;

            //---------------Test Result -----------------------
            Assert.IsFalse(dmClassEditorControl.EditUIDefinitionButton.Enabled);

            //---------------Tear Down -------------------------                 
        }

        [Test]
        public void Test_ClickingUIDefinitionButton_CallsUIEditorWithBO()
        {
            //---------------Set up test pack-------------------
            DMSolution dmSolution = TestUtilsShared.CreateSavedDMSolution();
            DMClass dmClass1 = dmSolution.DefaultAssembly.CreateClass(TestUtilsShared.GetRandomString());
            dmClass1.UIViews.CreateBusinessObject();

            //ControlFactoryWin controlFactoryStub = MockRepository.GenerateStub<ControlFactoryWin>();
            //controlFactoryStub.Stub(win => win.CreatePanel()).Return(new PanelWin());
            IUIViewsEditor uiViewsEditorStub = MockRepository.GenerateStub<IUIViewsEditor>();

            DMClassEditorControl dmClassEditorControl = new DMClassEditorControl(new ControlFactoryStub());
            dmClassEditorControl.BusinessObject = dmClass1;
            dmClassEditorControl.UIViewsEditor = uiViewsEditorStub;
 
            //---------------Execute Test ----------------------
            dmClassEditorControl.EditUIDefinitionButton.PerformClick();
            //---------------Test Result -----------------------

           uiViewsEditorStub.AssertWasCalled(editor => editor.EditUIViews(dmClass1));
            //---------------Tear Down -------------------------          
        }*/

    }

}